<!DOCTYPE html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">



  
  
    
    
  <script src="/lib/pace/pace.min.js?v=1.0.2"></script>
  <link href="/lib/pace/pace-theme-center-minimal.min.css?v=1.0.2" rel="stylesheet">







<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.3" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png?v=5.1.3">


  <link rel="icon" type="image/png" sizes="32x32" href="http://7xqdz8.com1.z0.glb.clouddn.com/avatar.png?v=5.1.3">


  <link rel="icon" type="image/png" sizes="16x16" href="http://7xqdz8.com1.z0.glb.clouddn.com/avatar.png?v=5.1.3">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.3" color="#222">





  <meta name="keywords" content="Android,笔记," />










<meta name="description" content="前言又到春节，大家这几天抢红包抢得高兴吗？最近，安卓“辅助功能”特性的应用倒是越来越火了，比如免Root自动安装应用、微信自动抢红包等，这些都是利用安卓的Accessibility实现的，所以是时候了解一下Accessibility了。">
<meta property="og:type" content="article">
<meta property="og:title" content="Accessibility辅助功能的使用">
<meta property="og:url" content="/2016/02/09/accessibility/index.html">
<meta property="og:site_name" content="一路前行">
<meta property="og:description" content="前言又到春节，大家这几天抢红包抢得高兴吗？最近，安卓“辅助功能”特性的应用倒是越来越火了，比如免Root自动安装应用、微信自动抢红包等，这些都是利用安卓的Accessibility实现的，所以是时候了解一下Accessibility了。">
<meta property="og:image" content="http://7xqdz8.com1.z0.glb.clouddn.com/160209accessibility.png">
<meta property="og:updated_time" content="2016-02-08T17:06:39.113Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Accessibility辅助功能的使用">
<meta name="twitter:description" content="前言又到春节，大家这几天抢红包抢得高兴吗？最近，安卓“辅助功能”特性的应用倒是越来越火了，比如免Root自动安装应用、微信自动抢红包等，这些都是利用安卓的Accessibility实现的，所以是时候了解一下Accessibility了。">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    version: '5.1.3',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="/2016/02/09/accessibility/"/>





  <title>Accessibility辅助功能的使用 | 一路前行</title>
  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?8193f7e44c62cdda245d5f109196c830";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">一路前行</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">Always believe that some thing wonderful is about to happen.</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="/2016/02/09/accessibility/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Voyager">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="http://7xqdz8.com1.z0.glb.clouddn.com/avatar.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一路前行">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Accessibility辅助功能的使用</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2016-02-09T01:06:39+08:00">
                2016-02-09
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Android/" itemprop="url" rel="index">
                    <span itemprop="name">Android</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="u524D_u8A00"><a href="#u524D_u8A00" class="headerlink" title="前言"></a>前言</h1><p>又到春节，大家这几天抢红包抢得高兴吗？最近，安卓“辅助功能”特性的应用倒是越来越火了，比如免Root自动安装应用、<strong>微信自动抢红包</strong>等，这些都是利用安卓的Accessibility实现的，所以是时候了解一下Accessibility了。<br><a id="more"></a></p>
<h1 id="u4ECB_u7ECD"><a href="#u4ECB_u7ECD" class="headerlink" title="介绍"></a>介绍</h1><blockquote>
<p><strong>官方介绍:</strong><br>许多Android用户有不同的能力,要求它们以不同的方式与他们的Android设备进行交互。这包括用户视觉、物理或年龄限制,防止他们完全看到或使用触摸屏,和用户与听力损失可能无法感知声音和警报信息。<br>Android提供了<strong>可访问性特性和服务</strong>更容易帮助这些用户导航设备,包括语音、触觉反馈,手势导航,轨迹球和directional-pad导航。Android应用程序开发人员可以利用这些服务使应用程序更容易。<br>Android开发者也可以建立自己的可访问性服务,可以提供增强的可用性特性,比如音频提示物理反馈,和替代导航模式。可访问性服务可以为所有应用程序提供这些增强功能,一组应用程序或只是一个单一的应用程序。</p>
</blockquote>
<p><img src="http://7xqdz8.com1.z0.glb.clouddn.com/160209accessibility.png" alt="辅助功能"></p>
<p>一个可访问性服务是一个应用程序,该应用程序提供用户界面增强帮助残障人士,或可能暂时无法完全与设备进行交互。例如,用户驾驶,照顾一个小孩或者参加一个非常热闹的派对可能需要额外的或替代接口反馈。<br>Android提供了标准的易访问性服务,包括反馈,开发人员可以创建和分发自己的服务。本文解释了构建一个可访问性的基础服务。</p>
<h1 id="u7533_u660E_u6E05_u5355_u548C_u6743_u9650"><a href="#u7533_u660E_u6E05_u5355_u548C_u6743_u9650" class="headerlink" title="申明清单和权限"></a>申明清单和权限</h1><p>提供可访问性服务的应用程序必须包括具体声明他们的应用程序表现被视为一个可访问性服务的Android系统。</p>
<h2 id="u7B2C_u4E00_u6B65_3A_Manifest_u53EF_u8BBF_u95EE_u6027_u670D_u52A1_u58F0_u660E"><a href="#u7B2C_u4E00_u6B65_3A_Manifest_u53EF_u8BBF_u95EE_u6027_u670D_u52A1_u58F0_u660E" class="headerlink" title="第一步: Manifest可访问性服务声明"></a>第一步: Manifest可访问性服务声明</h2><ul>
<li><p>声明服务</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="title">service</span> <span class="attribute">android:name</span>=<span class="value">".MyAccessibilityService"</span></span><br><span class="line">    <span class="attribute">android:label</span>=<span class="value">"@string/accessibility_service_label"</span></span><br><span class="line">    <span class="attribute">android:permission</span>=<span class="value">"android.permission.BIND_ACCESSIBILITY_SERVICE"</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="title">intent-filter</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="title">action</span> <span class="attribute">android:name</span>=<span class="value">"android.accessibilityservice.AccessibilityService"</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="title">intent-filter</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="title">service</span>&gt;</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>声明权限</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="title">uses-permission</span> <span class="attribute">android:name</span>=<span class="value">"android.permission.BIND_ACCESSIBILITY_SERVICE"</span> /&gt;</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
<h2 id="u7B2C_u4E8C_u6B65_3A__u53EF_u8BBF_u95EE_u6027_u670D_u52A1_u914D_u7F6E"><a href="#u7B2C_u4E8C_u6B65_3A__u53EF_u8BBF_u95EE_u6027_u670D_u52A1_u914D_u7F6E" class="headerlink" title="第二步: 可访问性服务配置"></a>第二步: 可访问性服务配置</h2><p>在目录<code>&lt;project_dir&gt;/res/xml/accessibility_service_config.xml</code>创建xml资源文件:<br><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="title">accessibility-service</span> <span class="attribute">xmlns:android</span>=<span class="value">"http://schemas.android.com/apk/res/android"</span></span><br><span class="line">    <span class="attribute">android:description</span>=<span class="value">"@string/accessibility_service_description"</span></span><br><span class="line">    <span class="attribute">android:packageNames</span>=<span class="value">"com.example.android.apis"</span></span><br><span class="line">    <span class="attribute">android:accessibilityEventTypes</span>=<span class="value">"typeAllMask"</span></span><br><span class="line">    <span class="attribute">android:accessibilityFlags</span>=<span class="value">"flagDefault"</span></span><br><span class="line">    <span class="attribute">android:accessibilityFeedbackType</span>=<span class="value">"feedbackSpoken"</span></span><br><span class="line">    <span class="attribute">android:notificationTimeout</span>=<span class="value">"100"</span></span><br><span class="line">    <span class="attribute">android:canRetrieveWindowContent</span>=<span class="value">"true"</span></span><br><span class="line">    <span class="attribute">android:settingsActivity</span>=<span class="value">"com.example.android.accessibility.ServiceSettingsActivity"</span></span><br><span class="line">/&gt;</span></span><br></pre></td></tr></table></figure></p>
<p>Manifest中引用:<br><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="title">service</span> <span class="attribute">android:name</span>=<span class="value">".MyAccessibilityService"</span>&gt;</span></span><br><span class="line">  ...</span><br><span class="line">  <span class="tag">&lt;<span class="title">meta-data</span></span><br><span class="line">    <span class="attribute">android:name</span>=<span class="value">"android.accessibilityservice"</span></span><br><span class="line">    <span class="attribute">android:resource</span>=<span class="value">"@xml/accessibility_service_config"</span> /&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="title">service</span>&gt;</span></span><br></pre></td></tr></table></figure></p>
<p>关于各个属性详解参见谷歌官方的<a href="http://developer.android.com/reference/android/accessibilityservice/AccessibilityServiceInfo.html" target="_blank" rel="external">AccessibilityServiceInfo文档</a></p>
<h2 id="u7B2C_u4E09_u6B65_3A__u6CE8_u518C_u4E3A_u53EF_u8BBF_u95EE_u6027_u4E8B_u4EF6"><a href="#u7B2C_u4E09_u6B65_3A__u6CE8_u518C_u4E3A_u53EF_u8BBF_u95EE_u6027_u4E8B_u4EF6" class="headerlink" title="第三步: 注册为可访问性事件"></a>第三步: 注册为可访问性事件</h2><p>可访问性的最重要的一个功能服务配置参数允许您指定您的服务可以处理什么类型的可访问性的事件。能够指定该信息相互配合支持可访问性服务,并允许你只作为开发人员灵活地处理特定事件类型从特定应用程序。事件过滤可以包括下列标准:</p>
<ul>
<li>包名 - 指定包名的应用程序的可访问性你想要你的服务来处理事件。如果省略该参数,那么你的可访问性服务被认为是用于服务为任何应用程序可访问性活动。在Service中配置 <code>android:packageNames</code>属性即可。</li>
<li>事件类型 - 指定类型的可访问性你想要你的服务来处理事件。使用 <code>android:accessibilityEventTypes</code>属性，如 <code>accessibilityEventTypes=&quot;typeViewClicked|typeViewFocused&quot;</code></li>
</ul>
<blockquote>
<p>当设置可访问性服务时,仔细考虑你服务是能够处理事件,只有注册这些事件。因为用户可以激活一个以上的可访问性服务,你的服务不能使用它无法处理的事件。记住,其他服务可能会处理这些事件以改善用户的体验。</p>
</blockquote>
<h2 id="u7B2C_u56DB_u6B65_3A__u91CD_u5199_u65B9_u6CD5"><a href="#u7B2C_u56DB_u6B65_3A__u91CD_u5199_u65B9_u6CD5" class="headerlink" title="第四步: 重写方法"></a>第四步: 重写方法</h2><p>继承 <code>AccessibilityService</code>类，重写服务开始时( <code>onServiceConnected()</code>)、运行时( <code>onAccessibilityEvent()</code>, <code>onInterrupt()</code>)、关闭( <code>onUnbind()</code>)四个方法。</p>
<blockquote>
<p>四个方法的具体调用细节参见<a href="http://developer.android.com/training/accessibility/service.html" target="_blank" rel="external">AccessibilityService实现</a></p>
</blockquote>
<h2 id="u7B2C_u4E94_u6B65_3A__u83B7_u53D6_u4E8B_u4EF6_u8BE6_u60C5"><a href="#u7B2C_u4E94_u6B65_3A__u83B7_u53D6_u4E8B_u4EF6_u8BE6_u60C5" class="headerlink" title="第五步: 获取事件详情"></a>第五步: 获取事件详情</h2><p>无障碍服务通过获取有关用户接口事件信息 <code>AccessibilityEvent</code>由系统传递到服务的  <code>onAccessibilityEvent()</code>回调方法。</p>
<ul>
<li><strong>AccessibilityEvent.getRecordCount()和getRecord(int)</strong> - 这些方法允许您检索一套AccessibilityRecord这有助于对象AccessibilityEvent传递给你的系统。这种详细程度为触发您的无障碍服务事件的详细内容。</li>
<li><strong>AccessibilityEvent.getSource()</strong> - 这个方法返回一个AccessibilityNodeInfo对象。这个对象允许您请求视图布局层次（父母和子女）发起的辅助事件的组件。此功能允许无障碍服务，调查事件的完整的上下文，包括任何封闭视图或子视图的内容和状态。</li>
</ul>
<h2 id="u7B2C_u516D_u6B65_3A__u4F7F_u7528_u53EF_u8BBF_u95EE_u6027_u52A8_u4F5C"><a href="#u7B2C_u516D_u6B65_3A__u4F7F_u7528_u53EF_u8BBF_u95EE_u6027_u52A8_u4F5C" class="headerlink" title="第六步: 使用可访问性动作"></a>第六步: 使用可访问性动作</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">MyAccessibilityService</span> <span class="keyword">extends</span> <span class="title">AccessibilityService</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="annotation">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">onAccessibilityEvent</span><span class="params">(AccessibilityEvent event)</span> </span>&#123;</span><br><span class="line">        <span class="comment">// get the source node of the event</span></span><br><span class="line">        AccessibilityNodeInfo nodeInfo = event.getSource();</span><br><span class="line"></span><br><span class="line">        <span class="comment">// Use the event and node information to determine</span></span><br><span class="line">        <span class="comment">// what action to take</span></span><br><span class="line"></span><br><span class="line">        <span class="comment">// take action on behalf of the user</span></span><br><span class="line">        nodeInfo.performAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);</span><br><span class="line"></span><br><span class="line">        <span class="comment">// recycle the nodeInfo object</span></span><br><span class="line">        nodeInfo.recycle();</span><br><span class="line">    &#125;</span><br><span class="line">    ...</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h1 id="u7ED3_u8BED"><a href="#u7ED3_u8BED" class="headerlink" title="结语"></a>结语</h1><p>至此，此文结束，只是写了一些来自官方文档的理论知识，这是利用这一特性进行实践的基础，所以相当地需要好好消化。</p>
<blockquote>
<p>PS: 最近发现一字一句手打博客效率实在是太低了，所以在以后的博客中我会多使用翻译软件和复制粘贴等来提高效率，这样也许就会造成有部分字词用词不当等问题(如果有什么大的问题可以联系我，我会及时修改)，还请谅解。</p>
</blockquote>

      
    </div>
    
    
    

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div></div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="http://7xqdz8.com1.z0.glb.clouddn.com/pay_weixin.png" alt="Voyager 微信支付"/>
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="http://7xqdz8.com1.z0.glb.clouddn.com/pay_alipay.jpg" alt="Voyager 支付宝"/>
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Android/" rel="tag"># Android</a>
          
            <a href="/tags/笔记/" rel="tag"># 笔记</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2016/02/07/happy/" rel="next" title="新年快乐">
                <i class="fa fa-chevron-left"></i> 新年快乐
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2016/02/11/jni_env/" rel="prev" title="JNI开发之环境搭建">
                JNI开发之环境搭建 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="http://7xqdz8.com1.z0.glb.clouddn.com/avatar.png"
                alt="Voyager" />
            
              <p class="site-author-name" itemprop="name">Voyager</p>
              <p class="site-description motion-element" itemprop="description">Android Developer</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">41</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">8</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                
                  <span class="site-state-item-count">10</span>
                  <span class="site-state-item-name">标签</span>
                
              </div>
            

          </nav>

          

          <div class="links-of-author motion-element">
            
              
                <span class="links-of-author-item">
                  <a href="https://github.com/a-voyager" target="_blank" title="GitHub">
                    
                      <i class="fa fa-fw fa-github"></i>GitHub</a>
                </span>
              
                <span class="links-of-author-item">
                  <a href="mailto:w19961009@126.com" target="_blank" title="E-Mail">
                    
                      <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                </span>
              
                <span class="links-of-author-item">
                  <a href="https://weibo.com/u/2306071720" target="_blank" title="微博">
                    
                      <i class="fa fa-fw fa-weibo"></i>微博</a>
                </span>
              
            
          </div>

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#u524D_u8A00"><span class="nav-number">1.</span> <span class="nav-text">前言</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#u4ECB_u7ECD"><span class="nav-number">2.</span> <span class="nav-text">介绍</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#u7533_u660E_u6E05_u5355_u548C_u6743_u9650"><span class="nav-number">3.</span> <span class="nav-text">申明清单和权限</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#u7B2C_u4E00_u6B65_3A_Manifest_u53EF_u8BBF_u95EE_u6027_u670D_u52A1_u58F0_u660E"><span class="nav-number">3.1.</span> <span class="nav-text">第一步: Manifest可访问性服务声明</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#u7B2C_u4E8C_u6B65_3A__u53EF_u8BBF_u95EE_u6027_u670D_u52A1_u914D_u7F6E"><span class="nav-number">3.2.</span> <span class="nav-text">第二步: 可访问性服务配置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#u7B2C_u4E09_u6B65_3A__u6CE8_u518C_u4E3A_u53EF_u8BBF_u95EE_u6027_u4E8B_u4EF6"><span class="nav-number">3.3.</span> <span class="nav-text">第三步: 注册为可访问性事件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#u7B2C_u56DB_u6B65_3A__u91CD_u5199_u65B9_u6CD5"><span class="nav-number">3.4.</span> <span class="nav-text">第四步: 重写方法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#u7B2C_u4E94_u6B65_3A__u83B7_u53D6_u4E8B_u4EF6_u8BE6_u60C5"><span class="nav-number">3.5.</span> <span class="nav-text">第五步: 获取事件详情</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#u7B2C_u516D_u6B65_3A__u4F7F_u7528_u53EF_u8BBF_u95EE_u6027_u52A8_u4F5C"><span class="nav-number">3.6.</span> <span class="nav-text">第六步: 使用可访问性动作</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#u7ED3_u8BED"><span class="nav-number">4.</span> <span class="nav-text">结语</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2015 &mdash; <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">WuHaojie</span>

  
</div>









        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  











  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>

  
  <script type="text/javascript" src="/lib/canvas-nest/canvas-nest.min.js"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.3"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.3"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.3"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.3"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.3"></script>



  


  




	





  





  








  





  

  

  

  

  

  

</body>
</html>
